package com.liusuai.yixian.user;

import com.alibaba.fastjson.JSONObject;
import com.liusuai.yixian.domain.ResultBean;
import com.liusuai.yixian.login.UserBean;
import com.liusuai.yixian.login.UserMapper;
import com.liusuai.yixian.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {

    @Autowired //自动连接到UserService Bean
    private UserMapper userMapper;

    public ResultBean selectAllUsers() {
        List<UserBean> list= userMapper.selectAllUsers();
        ResultBean<Object> resultBean = new ResultBean<>();
        if (list!=null){
            resultBean.setData(list);
            resultBean.setSuccess(true);
            resultBean.setCode(100);
        }else {
            resultBean.setSuccess(false);
            resultBean.setCode(110);
            resultBean.setMsg("未知错误");
        }
        return resultBean;
    }



}
